#include "mainwindow.h"
#include "QsLog/QsLog.h"

#include <QApplication>
#include <QSerialPort>
#include <QDebug>
#include <QDate>
#include <QMessageBox>




int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QsLogging::Logger& logger = QsLogging::Logger::instance();
    logger.setLoggingLevel(QsLogging::TraceLevel);
    //设置log位置为exe所在目录
    const QString sLogPath(QCoreApplication::applicationDirPath()+"/log/logging.txt");

    QsLogging::DestinationPtr fileDestination(QsLogging::DestinationFactory::MakeFileDestination(
        sLogPath, QsLogging::EnableLogRotation, QsLogging::MaxSizeBytes(512000), QsLogging::MaxOldLogCount(5)));

    if(!fileDestination->isValid()){
        QMessageBox::critical(nullptr, "错误", "无法打开日志" + sLogPath);
    }
    logger.addDestination(fileDestination);

    Widget w;
    w.show();
    return a.exec();
}

